 
timeout /T 3 /NOBREAK
@echo off
@REM Copyright 2018-present, Yudong (Dom) Wang
@REM
@REM Licensed under the Apache License, Version 2.0 (the "License");
@REM you may not use this file except in compliance with the License.
@REM You may obtain a copy of the License at
@REM
@REM      http://www.apache.org/licenses/LICENSE-2.0
@REM
@REM Unless required by applicable law or agreed to in writing, software
@REM distributed under the License is distributed on an "AS IS" BASIS,
@REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@REM See the License for the specific language governing permissions and
@REM limitations under the License.

@REM -----------------------------------------------------------------------------
@REM Holer Startup
@REM -----------------------------------------------------------------------------
title proxy-http-server
setlocal enabledelayedexpansion
set errorlevel=
set HOLER_OK=0
set HOLER_ERR=1
set HOLER_CURDIR=%~dp0
rem cd /d %HOLER_CURDIR%\..
set HOLER_HOME=%cd%
set HOLER_APP=!HOLER_HOME!\proxy_http.dart
set HOLER_LOG_DIR=!HOLER_HOME!\logs
set HOLER_LOG=!HOLER_LOG_DIR!\proxy-http.log
set HOLER_LINE=------------------------------------------
@echo HOLER_HOME
@echo HOLER_APP 
@REM Create logs directory
if not exist "!HOLER_LOG_DIR!" (
    mkdir "!HOLER_LOG_DIR!"
)
 set JAVA_BIN=dart 
@echo !HOLER_LINE!  
start /b  !JAVA_BIN!  "!HOLER_APP!" >> "!HOLER_LOG!"
timeout /T 3 /NOBREAK
@echo !HOLER_LINE!
tasklist | findstr !JAVA_BIN!
if !errorlevel! equ 0 (
    @echo !HOLER_LINE!
    @echo Started  proxy-http server.
    @echo.
    @echo The proxy-http server is running.
    @echo !HOLER_LINE!
) else (
    @echo proxy-http server is stopped.
    @echo Please check the log file for details [ !HOLER_LOG! ]
    @echo !HOLER_LINE!
)

pause
goto:eof
